package com.yeyks.common.em.mattress;

/**
 * @author fuchangshuai
 * @date 2019/07/23 14:47
 */
public class OrderInfoMattressEnum {
    public enum CalculateFlag {
        WAIT(0, "未结算"),
        COMPLETE(1, "已结算");
        int value;
        String desc;

        CalculateFlag(int value, String desc) {
            this.value = value;
            this.desc = desc;
        }

        public Integer value() {
            return this.value;
        }
    }

    public enum Status {
        PRE_PAY(1, "待支付"),
        STARTUP_SUCCESSFUL(2, "启动成功"),
        STARTUP_FAILED(3, "启动失败"),
        PAYMENT_FAILED(4, "支付失败"),
        REFUND_SUCCESS(5, "退款成功");

        int value;
        String desc;

        Status(int value, String desc) {
            this.value = value;
            this.desc = desc;
        }

        public Integer value() {
            return this.value;
        }

        public String desc() {
            return this.desc;
        }

        public static String getDesc(int value) {
            Status[] orderInfoMattressEnums = values();
            for (Status orderInfoMattressEnum : orderInfoMattressEnums) {
                if (orderInfoMattressEnum.value() == value) {
                    return orderInfoMattressEnum.desc();
                }
            }
            return null;
        }

        public static Integer getValue(String desc) {
            Status[] orderInfoMattressEnums = values();
            for (Status orderInfoMattressEnum : orderInfoMattressEnums) {
                if (orderInfoMattressEnum.desc().equals(desc)) {
                    return orderInfoMattressEnum.value();
                }
            }
            return null;
        }

    }
}
